<template>
  <div class="dashboard-home">
    <!-- 统计卡片 -->
    <div class="stats-grid">
      <div class="stat-card">
        <div class="stat-icon users">
          <i class="el-icon-user"></i>
        </div>
        <div class="stat-info">
          <h3>1,234</h3>
          <p>总用户数</p>
        </div>
      </div>
      <div class="stat-card">
        <div class="stat-icon orders">
          <i class="el-icon-s-order"></i>
        </div>
        <div class="stat-info">
          <h3>5,678</h3>
          <p>总订单数</p>
        </div>
      </div>
      <div class="stat-card">
        <div class="stat-icon revenue">
          <i class="el-icon-money"></i>
        </div>
        <div class="stat-info">
          <h3>¥89,012</h3>
          <p>总收入</p>
        </div>
      </div>
      <div class="stat-card">
        <div class="stat-icon products">
          <i class="el-icon-goods"></i>
        </div>
        <div class="stat-info">
          <h3>345</h3>
          <p>产品数量</p>
        </div>
      </div>
    </div>

    <!-- 图表区域 -->
    <div class="charts-section">
      <div class="chart-card">
        <h3>销售趋势</h3>
        <div class="chart-placeholder">
          <div class="chart-mock">
            <div class="chart-bar" style="height: 60%"></div>
            <div class="chart-bar" style="height: 80%"></div>
            <div class="chart-bar" style="height: 45%"></div>
            <div class="chart-bar" style="height: 90%"></div>
            <div class="chart-bar" style="height: 70%"></div>
            <div class="chart-bar" style="height: 85%"></div>
            <div class="chart-bar" style="height: 65%"></div>
          </div>
        </div>
      </div>
      <div class="chart-card">
        <h3>用户分布</h3>
        <div class="chart-placeholder">
          <div class="pie-chart">
            <div class="pie-segment" style="--percentage: 40; --color: #4FC3F7;"></div>
            <div class="pie-segment" style="--percentage: 30; --color: #2196F3;"></div>
            <div class="pie-segment" style="--percentage: 20; --color: #03DAC6;"></div>
            <div class="pie-segment" style="--percentage: 10; --color: #FF6B6B;"></div>
          </div>
        </div>
      </div>
    </div>

    <!-- 最近活动 -->
    <div class="activity-section">
      <div class="activity-card">
        <h3>最近活动</h3>
        <div class="activity-list">
          <div class="activity-item">
            <div class="activity-icon">
              <i class="el-icon-user"></i>
            </div>
            <div class="activity-content">
              <p>新用户 张三 注册了账号</p>
              <span class="activity-time">2分钟前</span>
            </div>
          </div>
          <div class="activity-item">
            <div class="activity-icon">
              <i class="el-icon-s-order"></i>
            </div>
            <div class="activity-content">
              <p>订单 #12345 已完成支付</p>
              <span class="activity-time">5分钟前</span>
            </div>
          </div>
          <div class="activity-item">
            <div class="activity-icon">
              <i class="el-icon-goods"></i>
            </div>
            <div class="activity-content">
              <p>产品 "智能手机" 库存不足</p>
              <span class="activity-time">10分钟前</span>
            </div>
          </div>
          <div class="activity-item">
            <div class="activity-icon">
              <i class="el-icon-message"></i>
            </div>
            <div class="activity-content">
              <p>收到新的客户反馈</p>
              <span class="activity-time">15分钟前</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DashboardHome',
  data() {
    return {
      // 可以添加一些数据
    };
  },
  mounted() {
    console.log('仪表板首页组件已挂载');
  }
};
</script>

<style scoped>
.dashboard-home {
  padding: 20px;
  min-height: calc(100vh - 60px);
}

/* 统计卡片样式 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: rgba(18, 18, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}

.stat-icon.users {
  background: linear-gradient(45deg, #4FC3F7, #2196F3);
}

.stat-icon.orders {
  background: linear-gradient(45deg, #03DAC6, #00BCD4);
}

.stat-icon.revenue {
  background: linear-gradient(45deg, #4CAF50, #8BC34A);
}

.stat-icon.products {
  background: linear-gradient(45deg, #FF9800, #FFC107);
}

.stat-info h3 {
  margin: 0;
  color: #fff;
  font-size: 24px;
  font-weight: bold;
}

.stat-info p {
  margin: 5px 0 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

/* 图表区域样式 */
.charts-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: rgba(18, 18, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.chart-card h3 {
  margin: 0 0 20px 0;
  color: #fff;
  font-size: 18px;
}

.chart-placeholder {
  height: 200px;
  display: flex;
  align-items: end;
  justify-content: center;
}

.chart-mock {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 100%;
  width: 100%;
  justify-content: space-around;
}

.chart-bar {
  background: linear-gradient(to top, #4FC3F7, #2196F3);
  width: 30px;
  border-radius: 4px 4px 0 0;
  transition: all 0.3s ease;
}

.chart-bar:hover {
  transform: scaleY(1.1);
}

.pie-chart {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(
    #4FC3F7 0deg 144deg,
    #2196F3 144deg 252deg,
    #03DAC6 252deg 324deg,
    #FF6B6B 324deg 360deg
  );
  margin: 0 auto;
}

/* 活动区域样式 */
.activity-section {
  margin-bottom: 30px;
}

.activity-card {
  background: rgba(18, 18, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.activity-card h3 {
  margin: 0 0 20px 0;
  color: #fff;
  font-size: 18px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(45deg, #4FC3F7, #2196F3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.activity-content p {
  margin: 0;
  color: #fff;
  font-size: 14px;
}

.activity-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .charts-section {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
</style>